var embed_player;(()=>{"use strict";var e={161:e=>{var t=Object.prototype.hasOwnProperty,n="~";function o(){}function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,o,i,a){if("function"!=typeof o)throw new TypeError("The listener must be a function");var s=new r(o,i||e,a),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],s]:e._events[l].push(s):(e._events[l]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function s(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,o,r=[];if(0===this._eventsCount)return r;for(o in e=this._events)t.call(e,o)&&r.push(n?o.slice(1):o);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},s.prototype.listeners=function(e){var t=n?n+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var r=0,i=o.length,a=new Array(i);r{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{n.r(o);var e,t=n(161);class LoaderRenderer{}e=LoaderRenderer,LoaderRenderer.attachLoader=(t,n)=>{const o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.style.width="0",o.style.height="0",o.setAttribute("xmlns","http://www.w3.org/2000/svg"),o.setAttribute("viewBox","-15 0 82 80"),o.setAttribute("shape-rendering","geometricPrecision"),o.setAttribute("text-rendering","geometricPrecision");const r=document.createElementNS("http://www.w3.org/2000/svg","path");r.classList.add("voomly-loader-path"),r.setAttribute("d","M100,140v68l57-34-57-34Z"),r.setAttribute("transform","translate(-94-134)"),r.setAttribute("fill","none"),r.setAttribute("stroke",n||"#008EFF"),r.setAttribute("stroke-width","10"),r.setAttribute("stroke-linejoin","round"),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-dasharray","145 76 145 76"),r.setAttribute("stroke-dashoffset","0"),o.appendChild(r);const i=performance.now();window.voomlyGlobalLoaderStart||(window.voomlyGlobalLoaderStart=i);const a=(performance.now()-window.voomlyGlobalLoaderStart)%2e3/1e3;r.style.animation="dash-loop 2s linear infinite",r.style.animationDelay=`-${a}s`,e.addLoaderDiv(t,o)},LoaderRenderer.addLoaderDiv=(e,t)=>{const n=document.createElement("div");n.classList.add("voomly-embed-loader__loader"),n.appendChild(t);const o=document.createElement("div");o.classList.add("voomly-embed-loader__wrapper"),o.appendChild(n);const r=e.getAttribute("data-ratio")||"1.777777",i=document.createElement("div");i.classList.add("voomly-embed-loader"),i.style.position="relative",i.style.width="100%",i.style.paddingTop=100/parseFloat(r)+"%",i.appendChild(o),e.appendChild(i)},LoaderRenderer.addLoaderCss=()=>{const e="voomly-embed-loader-css";if(document.getElementById(e))return;const t=document.createElement("style");t.id=e,t.innerHTML=".voomly-embed-loader__loader{max-width: min(calc(100% - 20px), 128px);max-height: min(calc(100% - 20px), 128px);padding:min(40px, 15%);aspectRatio: 1;border-radius:9999px;background:rgba(255,255,255,0.3); margin: 10px;}.voomly-embed-loader__loader svg{display:block;width:100%!important;height:100%!important;max-width:48px;max-height:48px;}.voomly-embed-loader__wrapper{display: flex; align-items: center; justify-content: center; padding: 0; flex: 1; width: 100%; height: 100%; pointer-events: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);} @keyframes dash-loop { from { stroke-dashoffset: 0; } to { stroke-dashoffset: 442; } }",document.head.appendChild(t)};const r=e=>`[voomly-embed-player] ${e}`,i=["isInitialized","isDestroyed","destroy","onAPIReady","seek","play","pause","changeVolume","mute","unmute","changeQuality","changeSpeed","getQualityOptions","getSpeedOptions","enableCustomTurnstileIntegration","onPlay","onPause","onSeekStarted","onSeeked","onTimeUpdate","onQualityChange","onVolumeChange","onSpeedChange","onReady","onEnd","onGetQualityOptions","onGetSpeedOptions","onUpdateDimensions","onTimelineUnlock","onTimelineTurnstileSkipped","onTimelineTurnstileCompleted","onTimelineButtonClick","onTimelineButtonEnter","onTimelineButtonPreExit","onTimelineButtonExit","onTimelineImageClick","onTimelineImageEnter","onTimelineImagePreExit","onTimelineImageExit","onTimelineGridClick","onTimelineGridEnter","onTimelineGridPreExit","onTimelineGridExit","onTimelineSurveyClick","onTimelineSurveyEnter","onTimelineSurveyPreExit","onTimelineSurveyExit","onTimelineQuizChoice","onTimelineQuizEnter","onTimelineQuizExit","onTimelineAnnotationClick","onTimelineImageAnnotationClick","on"].reduce(((e,t)=>(e.set(t,!0),e)),new Map);class PlayerExternalAPIInterceptor{constructor(){this.callsQueueByContainer=new Map,this.instanceMap=new Map,this.getProxy=(e,t)=>{const n=this.instanceMap.get(e);if(n?.proxy&&n.realAPI&&n.realAPI===t)return n.proxy;const o=((e,t,n)=>new Proxy(e,{get(e,o){if(n.has(o))return e=>t(o,e)}}))(t||{},((t,n)=>{const o=window.voomlyEmbedPlayerApp?.getPlayerExternalAPIByContainer(e);if("getDevInstance"===t)return o;const r=window.voomlyEmbedPlayerApp?.getPlayerExternalAPILoadStatusByContainer(e);if(o&&r)return void a(o,t,n);let i=this.callsQueueByContainer.get(e);i||(i=[],this.callsQueueByContainer.set(e,i)),i.push([t,n])}),i);return this.instanceMap.set(e,{proxy:o,realAPI:t}),o},this.callAllMethodsFromQueue=e=>{const t=window.voomlyEmbedPlayerApp?.getPlayerExternalAPILoadStatusByContainer(e);if(!t)return;const n=window.voomlyEmbedPlayerApp?.getPlayerExternalAPIByContainer(e);if(!n)return;const o=this.callsQueueByContainer.get(e);o&&(o.forEach((([e,t])=>{a(n,e,t)})),this.callsQueueByContainer.delete(e))}}}const a=(e,t,n)=>{e.onAPIReady((()=>{"function"==typeof e[t]&&e[t].apply(e,Array.isArray(n)?n:[n])}))},s=async(e,t,n,o={})=>{const r=async r=>{const i=n-1;if(!i)throw r;return await(e=>new Promise((t=>setTimeout(t,e))))(t),s(e,t,i,o)};try{const t=await fetch(e,o);if(!t.ok){const e=new Error(`HTTP error! status: ${t.status}`);return e.status=t.status,r(e)}return t}catch(i){return r(i)}},l="https://embed.voomly.com/embed",d="https://media.voomly.com",c="https://api.voomly.com",m="https://waf.voomly.com",p="voomly-embed-script",y="voomly-embed-media-preconnect-link";class Preloader{constructor(){this.preloaderReadyEmitter=new t.EventEmitter,this.isReady=!1,this.manifest=void 0,this.apiInterceptor=new PlayerExternalAPIInterceptor,this.setManifest=e=>{this.manifest=e},this.playersToAttach=[],this.manifestPromise=void 0,this.init=()=>{this.askWAFIfBot(),this.initStyles(),this.initMainScript(),this.addOptimizationLinks(),["interactive","complete"].includes(document.readyState)?this.initLoaders():document.addEventListener("DOMContentLoaded",this.initLoaders)},this.askWAFIfBot=async()=>{try{await fetch(m).then((e=>(403===e.status&&(console.error(r("Bot detected")),window?.voomlyEmbedPlayerPreloader&&(window.voomlyEmbedPlayerPreloader.isBotDetected=!0)),e)))}catch(e){console.error(r("Bot detection failed"),e)}},this.initStyles=async()=>{const e=()=>{n.setAttribute("data-loaded","");const e=new CustomEvent("voomly-styles-loaded");document.dispatchEvent(e),clearTimeout(o)},t=await this.manifestPromise,n=document.createElement("link");n.rel="stylesheet",n.href=t["embed-player-styles.css"],n.setAttribute("data-voomly-styles",""),n.onload=t=>e(),document.head.appendChild(n);const o=setTimeout((()=>{e(),console.warn("Voomly styles didn't load in 10 seconds")}),1e4)},this.initMainScript=async()=>{"undefined"!=typeof window&&this.addMainScript()},this.addOptimizationLinks=()=>{if(!document.getElementById(y)){0;const e=document.createElement("link");e.rel="preconnect",e.href=d,e.id=y,document.head.appendChild(e)}},this.initLoaders=()=>{let e=!1;const t=document.getElementsByClassName("voomly-embed");for(let n=0;n{const e=document.getElementsByClassName("voomly-embed"),t=t=>this.playersToAttach.some((e=>e.type===t))||Array.from(e).some((e=>this.getDataType(e)===t)),n=t("f");return t("c")?"embed-build-with-video-collection-app.js":n?"embed-build-with-funnel-app.js":"embed-build-app.js"},this.addMainScript=async()=>{if(document.getElementById(p))return;const e=document.getElementsByTagName("script"),t=Array.from(e).find((e=>e.src.includes("embed-build.js"))),n=document.createElement("script");n.id=p,n.defer=!0;try{const e=await this.manifestPromise;n.src=e[this.getMainScriptTypeToLoad()],n.onload=this.onLoadMainScript,t&&t.parentNode?t.parentNode.insertBefore(n,t.nextSibling):document.head.appendChild(n)}catch(o){console.error(r(`Failed to load ${this.getMainScriptTypeToLoad()}`),{manifestUrl:`${l}/manifest.json`,appUrl:n.src},o)}},this.onLoadMainScript=async()=>{window.voomlyEmbedPlayerApp?(window.attachVoomlyPlayer=(e,...t)=>{const n=window.voomlyEmbedPlayerApp.attach(e,...t);return this.apiInterceptor.getProxy(e,n)},window.attachVoomlyPlayers=window.voomlyEmbedPlayerApp.attachAll,window.attachVoomlyPlayers?.(),this.playersToAttach.forEach((e=>window.attachVoomlyPlayer?.(e.element,e.id,e.type,e.ratio,e.presentation,e.skinColor,e.externalPlayerConfig))),window.voomlyEmbedPlayerApp.startAttachChecker(),this.isReady=!0,this.preloaderReadyEmitter.emit("ready")):console.warn(r("window.voomlyEmbedPlayerApp is not defined"))},this.preloadVideoData=e=>{const t=e.getAttribute("data-id"),n=this.getDataType(e);if(!t)return;const o=((e,t)=>`voomly-embed-video-data-${e}-${t}-link`)(t,n);if(document.getElementById(o))return;const r=document.createElement("link");r.crossOrigin="anonymous",r.rel="prefetch";const i={v:`${c}/embed-videos/${t}`,f:`${c}/video-funnels/${t}`,c:`${c}/video-collections/${t}`};r.href=i[n],r.id=o,document.head.appendChild(r)},this.getDataType=e=>e.getAttribute("data-type")||"v",this.attachPlayerInterceptor=(e,t,n,o,r,i,a)=>(this.playersToAttach.push({element:e,id:t,type:n,ratio:o,presentation:r,skinColor:i,externalPlayerConfig:a}),this.apiInterceptor.getProxy(e)),this.emitAttached=e=>{this.preloaderReadyEmitter.emit("attached",e)},this.onAttached=(e,t)=>{const n=window.voomlyEmbedPlayerApp?.getAllPlayerDescriptorsById(e)?.[0];if(!n)return this.preloaderReadyEmitter.on("attached",t),()=>this.preloaderReadyEmitter.off("attached",t);t(n)},this.onReady=e=>this.isReady?(e(),()=>{}):(this.preloaderReadyEmitter.on("ready",e),()=>{this.preloaderReadyEmitter.off("ready",e)}),this.callPreviouslyCalledMethod=e=>{this.apiInterceptor.callAllMethodsFromQueue(e)},window.attachVoomlyPlayer=this.attachPlayerInterceptor,this.manifestPromise=s(`${l}/manifest.json`,1e3,5).then((e=>e.json())).then((e=>(this.setManifest(e),e)))}}window.voomlyEmbedPlayerPreloader||(window.voomlyEmbedPlayerPreloader=new Preloader,window.voomlyEmbedPlayerPreloader.init())})(),embed_player=o})();